import { Effect, ImmerReducer, Reducer, Subscription } from 'umi';
import {_showUser} from "../api/showUser"
export interface IndexModelState {
  showlist:[]
}

export interface IndexModelType {
  namespace: 'showUser';
  state: IndexModelState;
  effects: {
    getshowlist: Effect;
  };
  reducers: {
     SHOW_LIST: Reducer<IndexModelState>
  };
}

const IndexModel: IndexModelType = {
  namespace: 'showUser',

  state: {
    showlist: [],
  },
  reducers: {
    SHOW_LIST(state:any, {action}:any) {
      return {
        ...state,
        showlist:[...action]
      };
    },
  },

  effects: {
    *getshowlist({ action }, { call, put }) {
        console.log(action);
        let result = yield call(_showUser,action)
        console.log(result,"展示数据");
        if(result.data.code==1){
            yield put({type:"SHOW_LIST",action:result.data.data})
        }
        
        
        
    },
  },
  
};

export default IndexModel;
